# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=angrop
pkgver=408.15616aa
pkgrel=4
pkgdesc='A rop gadget finder and chain builder.'
groups=('blackarch' 'blackarch-exploitation')
arch=('any')
url='https://github.com/salls/angrop'
license=('BSD')
depends=('python' 'angr' 'python-tqdm')
makedepends=('git' 'python-build' 'python-pip')
source=("git+https://github.com/salls/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  python -m build --wheel --outdir="$startdir/dist"
}

package() {
  cd $pkgname

  pip install --verbose \
              --disable-pip-version-check \
              --no-warn-script-location \
              --ignore-installed \
              --no-compile \
              --no-deps \
              --root="$pkgdir" \
              --prefix=/usr \
              --no-index \
              --find-links="file://$startdir/dist" \
              "$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/$pkgname/tests" tests/*
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

